import { createWebHashHistory, createRouter } from "vue-router";

import HomeView from "../views/home/index.vue";

const routes = [
  { path: "/", redirect: "/home" },
  { path: "/home", component: HomeView, meta: { title: "首页" } },
  {
    path: "/utils",
    children: [
      {
        path: "",
        meta: { title: "工具类方法" },
        component: () => import("../views/utils/index.vue"),
      },
      {
        path: "formatDate",
        meta: { title: "时间格式化方法" },
        component: () => import("../views/utils/formatDate.vue"),
      },
      {
        path: "request",
        meta: { title: "axios请求方法封装" },
        component: () => import("../views/utils/request.vue"),
      },
      {
        path: "debounce",
        meta: { title: "防抖方法" },
        component: () => import("../views/utils/debounce.vue"),
      },
    ],
  },
  {
    path: "/tools",
    children: [
      {
        path: "",
        meta: { title: "工具类方法" },
        component: () => import("../views/tools/index.vue"),
      },
      {
        path: "boxshadow",
        meta: { title: "盒子阴影在线调试" },
        component: () => import("../views/tools/box-shadow.vue"),

      },
    ],
  },
  {
    path: "/comp",
    children: [
      {
        path: "",
        meta: { title: "组件集合" },
        component: () => import("../views/comp/index.vue"),
      },
      {
        path: "icon-select",
        meta: { title: "图标下拉选择器" },
        component: () => import("../views/comp/icon-select.vue"),
      },
      {
        path: "table-page",
        meta: { title: "表格页面" },
        component: () => import("../views/comp/table-page.vue"),
      },
    ],
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});
export default router;
